Hi,
string getTargets(Object obj, string finalString, int level)
{
level++
Link lnk
for lnk in obj -> "*" do
{
Object newObj = target(lnk)
finalString = getTargets(newObj, finalString, level)
}
level--
string levelString=""
int i
for(i=0;i<level;i++)
{
levelString=levelString "..."
}
Module newMod = module(obj)
string returnString = obj."Absolute Number" ""
returnString = newMod."Prefix" returnString "\n" finalString
returnString = levelString returnString
return returnString
}
Module mod = current
Object obj
string filename = "Export.txt"
Stream out = write filename
for obj in mod do
{
print getTargets(obj, "", 0)
out << getTargets(obj, "", 0)
}
close out
joeyvitoro - Thu Feb 02 10:29:29 EST 2012 |
Re: Accessing root in-links of an object
In help file look for the following:
source
Declaration
string source({Link|LinkRef} l)
ModName_ source({Link|LinkRef} l)
Object source(Link l)
Operation
The first form returns the unqualified name of the module that is the source of l, which can be of type Link or LinkRef.
The second form returns a reference to the module that is the source of l, which can be of type Link or LinkRef.
The third form returns the source object of link l.
Example
Object o = current
LinkRef lref
ModName_ srcModRef
for lref in o<-"*" do {
srcModRef = source lref
read(fullName(srcModRef), true)
}
|
Re: Accessing root in-links of an object rain_bow - Thu Feb 02 13:00:38 EST 2012
In help file look for the following:
source
Declaration
string source({Link|LinkRef} l)
ModName_ source({Link|LinkRef} l)
Object source(Link l)
Operation
The first form returns the unqualified name of the module that is the source of l, which can be of type Link or LinkRef.
The second form returns a reference to the module that is the source of l, which can be of type Link or LinkRef.
The third form returns the source object of link l.
Example
Object o = current
LinkRef lref
ModName_ srcModRef
for lref in o<-"*" do {
srcModRef = source lref
read(fullName(srcModRef), true)
}
|
Re: Accessing root in-links of an object joeyvitoro - Thu Feb 02 13:28:43 EST 2012 Why not use the DOORS "Analysis Wizard" feature to create a DXL Layout column that displays these multiple hop links back to the root (Module Menu: Analysis > Wizard). This feature uses indenting to display the nested link relationships in one column, or there is an option to shown each link hop in separate columns (the one column option is recommended). It doesn't have a specific option to trace all the way back to the root, but all you need to do is set the "Specify Depth of Analysis" option to some high number so that you're confident that it's tracing all the way back to the root. This would allow you to set up a DOORS module view that has a column for the UID, the Main column with the requirements text and a multiple hop trace column as described above, then print this View. At the very least, you can view the DXL code that is auto generated for this feature which may you give you some ideas on the DXL code needed to do this. Paul Miller Melbourne, Australia |
Re: Accessing root in-links of an object SystemAdmin - Thu Feb 02 19:19:05 EST 2012 Paul Miller Melbourne, Australia That might be just what I need. Thanks! I've added the column as you suggested, but how do I view the DXL that was auto-generated? |
Re: Accessing root in-links of an object
Started this yesterday, finished this morning.
Buffer g_bufResults = null
void getTargets(Object obj, int level)
{
if (null obj) return
Link lnk
ModName_ mn
// ModuleVersion mv
int i
Object newObj
//ModuleVersion moduleVersion(ModName_)
//print identifier(obj) "\n"
g_bufResults += identifier(obj)
g_bufResults += "\n"
for(i=0;i<level;i++)
{
g_bufResults += ".>>"
}
for lnk in obj -> "*" do
{ mn = target(lnk)
if (null mn) continue
read(fullName(moduleVersion(mn)), false, true)
newObj = target(lnk)
getTargets(newObj, ++level)
}
}
Module mod = current
Object obj
string filename = "c:\\Doors-Stuff\\Reports\\Export.txt"
Stream out = write filename
g_bufResults = create()
for obj in mod do
{ setempty(g_bufResults)
getTargets(obj, 0)
out << tempStringOf(g_bufResults)
}
close out
delete(g_bufResults)
system("notepad.exe " filename)
|
Re: Accessing root in-links of an object llandale - Fri Feb 03 09:21:18 EST 2012
Started this yesterday, finished this morning.
Buffer g_bufResults = null
void getTargets(Object obj, int level)
{
if (null obj) return
Link lnk
ModName_ mn
// ModuleVersion mv
int i
Object newObj
//ModuleVersion moduleVersion(ModName_)
//print identifier(obj) "\n"
g_bufResults += identifier(obj)
g_bufResults += "\n"
for(i=0;i<level;i++)
{
g_bufResults += ".>>"
}
for lnk in obj -> "*" do
{ mn = target(lnk)
if (null mn) continue
read(fullName(moduleVersion(mn)), false, true)
newObj = target(lnk)
getTargets(newObj, ++level)
}
}
Module mod = current
Object obj
string filename = "c:\\Doors-Stuff\\Reports\\Export.txt"
Stream out = write filename
g_bufResults = create()
for obj in mod do
{ setempty(g_bufResults)
getTargets(obj, 0)
out << tempStringOf(g_bufResults)
}
close out
delete(g_bufResults)
system("notepad.exe " filename)
|
Re: Accessing root in-links of an object joeyvitoro - Fri Feb 03 07:50:28 EST 2012 Hover your mouse over the title cell of the column that was created by the Analysis Wizard RH mouse click, select Properties - the Layout DXL radio button option should already be selected Click the Browse button Click the Current button Paul Miller Melbourne, Australia |